package com.wd.mysquare.viewmodel

import android.util.Log
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.wd.current.model.Bean.DataBean
import com.wd.current.model.Utils.HttpUtils
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

/**
 * 作者: 张智聪
 * 时间: 2024/10/18
Time:  12:25
 * 描述:
 */
class SquareViewModel:ViewModel() {
    var findNearbyLiveData= MutableLiveData<DataBean.HomeList>()
    fun  getNearbyLiveData(userId: Int,
                           liveType: Int,
                           page: Int,
                           size: Int,){
        HttpUtils.httpUtils.aplis2.getHomeList(userId,liveType,page,size)
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe({
             findNearbyLiveData.value=it
                com.google.android.exoplayer2.util.Log.i("aaaaaaa",it.result.toString())
            },{
                com.google.android.exoplayer2.util.Log.i("httphttp11111111111111",it.toString())
            })

    }



//    fun getNearbyLiveData(userId:Int, longitude:String, latitude:String, sex:Int, range:Int){
//      HttpUtils.httpUtils.aplis2.getNearbyLive(userId, longitude, latitude, sex, range)
//          .subscribeOn(Schedulers.io())
//          .observeOn(AndroidSchedulers.mainThread())
//          .subscribe({
//              findNearbyLiveData.value=it
//              Log.i("bb",it.toString())
//          },{
//              Log.i("aaa",it.toString())
//              Log.i("aaaa"+it.message,"")
//              println(it)
//          })
//    }
}